package http

import (
	"robot/study/LiveRobot/define"
	"robot/study/LiveRobot/reptile"
	"strings"
)

func init() {

}

func routerInit(msg *define.Message2) {
	routers := []routeData{
		//回复处理
		{SendFunc(msg, define.TRANSLATE, reptileSweet)},
		{SendFunc(msg, define.HOT, reptileVideo)},
		{SendFunc(msg, define.VIDEO, reptileSendVideo)},
		{SendFunc(msg, define.REVIEWOFF, reptileRebWorkOff)},
		{SendFunc(msg, define.REVIEWOPEN, reptileRebWorkOpen)},
		{SendFunc(msg, define.SETU, reptileSendImage)},
		{SendFunc(msg, define.RESPONSEOFF, reptileResponseOff)},
		{SendFunc(msg, define.RESPONSEOPEN, reptileResponseOpen)},
		//画图
		{SendFunc(msg, define.Draw_Answer, drawEquationAnswer)},
		{SendFunc(msg, define.Draw_Curve, drawCurve)},
		{SendFunc(msg, define.Draw_LinearFunction, drawLinearFunction)},
	}
	//图片复读鸡
	if reptile.Reb.Flag == true && strings.Contains(msg.RawMessage, "[CQ:image") {
		reptileReview(msg)
	}
	//智能回答
	if reptile.Res.Flag == false {
		return
	}

	var res int
	for _, v := range routers {
		if v.handler != nil {
			res += 1
		}
	}
	//判断是否为智能回答
	if res == 0 {
		reptileIntelligentAnswer(msg)
	}
}
